
    function xuetiao(){
     function random(min,max) {
        return Math.floor( Math.random() * (max-min+1)+min)
    }
    // 1计时器
    setInterval(function(){
        // 2页面中造img标签
        var imgObj = document.createElement('img')
        // 3给图片src赋值
        imgObj.src='./star.gif'
        // 4获取图片随机宽高
        var w = random(20,40)
        imgObj.width = w
        imgObj.height = w
        // 5使图片出现的位置随机
        imgObj.style.position = 'absolute'
        var maxH = (window.innerWidth || document.documentElement.clientWidth) - w
        var maxH = (window.innerHeight || document.documentElement.clientHeight) - w
        var l = random(0,maxH)
        var t = random(0,maxH)
        imgObj.style.left = l + 'px'
        imgObj.style.top = t + 'px'
        document.body.appendChild(imgObj)
    },1000)
    // 点击删除小星星
    document.body.onclick = function(evt){
var e = evt || window.event
var target = e.target || e.srcElement
console.log('img')
// var w = document.querySelector('.xue') 
if (target.nodeName === 'IMG')
var w = document.querySelector('.xue') 
    {
        document.body.removeChild(target)
        var xue = parseInt(w.style.width)
        if (xue+1 !==100)
        {
            w.style.width = xue+1 + 'px'
        }
    }
    }
// 三、血条-1
setInterval(function() {
    var w = document.querySelector('.xue') 
    var xue = parseInt(w.style.width)
    console.log(xue)
   w.style.width = xue-1 + 'px'
}, 1000)
}
xuetiao()
